﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <style type="text/css">
        .border {
            border: 1px solid red;
            margin: 1px;
            width: 200px;
        }
    </style>
    <script src="../Resource/Jquery/jquery-1.10.2.js"></script>
</head>
<body>
    <div id="container"></div>
    Time:<input type="text" id="timer" />
    <input type="button" value="开始添加" onclick="append()();" />
    <input type="button" value="暂停" onclick="window.clearTimeout(setId);" />
    <input type="button" value="继续" onclick="append()();" />
</body>
</html>
<script>
    var getId = (function () {
        var id = 1;
        return function () {
            return id++;
        }
    })();

    var append = (function () {
        var id = getId();

        var html = "<div class='border' id='" + id + "'>第" + id + "个</div>";
        $("#container").append($(html));

        var arg = arguments.callee;
        var that = this;
        window.setId = window.setTimeout(function () { arg.apply(that, []); }, parseInt($("#timer").val()) * 1000);
    });

    var arr = [{ "ZLAMT": 157270894.53, "FZLAMT": 140882376.05, "TIME": "2010" },
        { "ZLAMT": 185514052.940000002, "FZLAMT": 301384496.68, "TIME": "2011" },
        { "ZLAMT": 248145891.01, "FZLAMT": 386995856.34, "TIME": "2012" },
        { "ZLAMT": 103519220.73, "FZLAMT": 151049195.39, "TIME": "2013" }];
       
    var d1 = 0;
    var d2 = 0;
    for (var i = 0; i < arr.length; i++) {
        d1 += parseFloat(arr[i].ZLAMT);
        d2 += parseFloat(arr[i].FZLAMT);
    }

    console.log(d1);
    console.log(d2);


    var _d = { dep: ["战略客户", "非战略客户"], year: year, data: [d1, d2] };
        



</script>
